import axios from '@/libs/api.request'
import qs from 'qs'
import Cookies from 'js-cookie'
//获取分页订单列表请求接口
export const getTableData = ({ page, rows }) => {
  const data = {
    page,
    rows
  }
  return axios.request({
    url: 'pageListOrders?sysUserBySysUserId.userId='+Cookies.get('userId'),
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//查询分页订单列表请求接口
export const quOrderData = (data) => { 
  return axios.request({
    url: 'pageListOrders?sysUserBySysUserId.userId='+Cookies.get('userId'),
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}

//获取单个订单内容接口
export const getOrdersData = ({ordersId }) => {
  const data = {
    ordersId
  }
  return axios.request({
    url: 'listOrders',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取用户列表
export const getUserlist = (data) => {
  return axios.request({
    url: 'listSysUser',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//获取部门列表
export const getDeplist = () => {
  return axios.request({
    url: 'listDept',
    method: 'post'
  })
}

//获取车辆列表
export const getVehlist = () => {
  return axios.request({
    url: 'listVehModel',
    method: 'post'
  })
}
//订单表单提交方法
export const subOrderData = (data) => { 
  return axios.request({
    url: 'addOrders',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}
//地图模糊查询方法
export const mapQuerydata = (data) => { 
  return axios.request({
    url: 'http://restapi.amap.com/v3/assistant/inputtips?s=rsv3&key=8c5fb3a478d828cadebfa1ab6ec78b2b&callback=jsonp_798575_&platform=JS&logversion=2.0&sdkversion=1.3&appname=http%3A%2F%2Fyls.yxtdh.cn%2FylsWeb%2Fjsp%2FconfirmOrder.jsp%3FmenuSel%3D1&csid=0482619F-50A5-490D-9358-4AF39F4B13DF',
    data: qs.stringify(data, { arrayFormat: 'brackets' }),
    method: 'post'
  })
}